home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.3 (Developer)…68k, x86, SPARC, PA-RISC] / NeXTSTEP 3.3 Dev Intel.iso / NextDeveloper / Headers / sound / accesssound.h next >
Text File  |  1991-09-26  |  3KB  |  81 lines

  1.  
  2. /*
  3.  *    accesssound.h
  4.  *    Copyright 1988-89 NeXT, Inc.
  5.  *
  6.  */
  7.  
  8. #import "soundstruct.h"
  9. #import "sounderror.h"
  10. #import <mach/cthreads.h>
  11.  
  12. #define SND_ACCESS_OUT 1
  13. #define SND_ACCESS_DSP 2
  14. #define SND_ACCESS_IN 4
  15.  
  16. typedef struct {
  17.     int priority;
  18.     int duration;
  19. } SNDNegotiationData;
  20.  
  21. typedef int (*SNDNegotiationFun)(void *arg, SNDNegotiationData *data);
  22.  
  23. #define NULL_NEGOTIATION_FUN ((SNDNegotiationFun)0)
  24.  
  25. int SNDAcquire(int access_code, int priority, int preempt, int timeout,
  26.         SNDNegotiationFun negotiation_function, void *arg,
  27.         port_t *device_port, port_t *owner_port);
  28. int SNDReset(int access_code, port_t dev_port, port_t owner_port);
  29. int SNDRelease(int access_code, port_t device_port, port_t owner_port);
  30. /*
  31.  * Acquire/release the specified resources. Acquiring a resources makes
  32.  * it active, such that other acquisition requests may fail (even in the
  33.  * requests are in the same process). These calls should bracket any use
  34.  * of the resources. These functions are automatically called by
  35.  * SNDStartPlaying and SNDStartRecording. The SNDReset function causes the
  36.  * owned resources to be reset to the state that they were when acquired.
  37.  * If access is granted, another attempt at access will cause the
  38.  * negotiation function to be called. Returning a value of zero indicates
  39.  * that access is being released and for the caller to try again. If a
  40.  * null function is provided, ownership of the resources is absolute.
  41.  */
  42.  
  43. int SNDReserve(int access_code, int priority);
  44. /*
  45.  * Establishes exclusive use of specified resources until SNDUnreserve
  46.  * is called or the process terminates. If this routine is not called,
  47.  * then SNDStartPlaying or SNDStartRecording will obtain access and release it 
  48.  * automatically. The access_code determines which physical resources are
  49.  * to be reserved, and the priority is used to resolve conflicts.
  50.  * Use of this routine is optional; if used, it must eventually be followed by 
  51.  * a call to SNDUnreserve.
  52.  * An error code is returned if the resources cannot be reserved.
  53.  */
  54.  
  55. int SNDUnreserve(int access_code);
  56. /*
  57.  * Frees up sound resources for other processes to use.
  58.  * An error code is returned if the sound is not already reserved.
  59.  */
  60.  
  61. int SNDSetHost(char *newHostname);
  62. /*
  63.  * Chooses the host by name for subsequent playback or recording. Passing
  64.  * NULL or a zero length string restores the default, which is the local
  65.  * host. If sound is currently recording or playing, or if the sound resources
  66.  * are reserved, then the host cannot be changed.
  67.  * an error code is returned.
  68.  */
  69.  
  70. int SNDBootDSP(port_t device_port, port_t owner_port, SNDSoundStruct *dspCore);
  71. /*
  72.  * Boots the dsp specified by the device_port and owner_port (obtained via
  73.  * SNDAcquire). The boot image is specified in an SNDSoundStruct, which can
  74.  * be created by SNDReadDSPfile (see filesound.h).
  75.  * This routine uses a bootstrap downloader, making possible the loading
  76.  * of all internal and external RAM of the DSP except for the top 6 words
  77.  * of external ram.
  78.  */
  79.  
  80.  
  81.